<template>
  <div class='main-header'>
    <div class='menu-icon' @click='handleMenuIconClick'>
      <el-icon size='30'>
        <component :is="isFold ? 'Expand' : 'Fold'" />
      </el-icon>
    </div>
    <div class='content'>
      <div class='breadcrumb'>
        <header-crumb></header-crumb>
      </div>
      <header-info></header-info>
    </div>
  </div>
</template>

<script setup lang='ts'>
import { ref } from 'vue'
import HeaderCrumb from '@/components/main-header/comp/header-crumb.vue'
import { useLoginStore } from '@/stores/login/index'

const emit = defineEmits(['foldChange'])

const isFold = ref(false)

const handleMenuIconClick = () => {
  // 内部改变状态
  isFold.value = !isFold.value

  // 将事件和状态传递给父组件
  emit('foldChange', isFold.value)
}

const loginStore = useLoginStore()
</script>

<style scoped lang='less'>
.main-header {
  display: flex;
  align-items: center;
  flex: 1;
  height: 100%;

  .menu-icon {
    display: flex;
    align-items: center;
    cursor: pointer;
  }

  .content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    padding: 0 18px;
  }
}
</style>
